#ifndef __M_CONSUMER_H__
#define __M_CONSUMER_H__
#include <iostream>
#include <string>
#include <unordered_map>
#include <memory>
#include <vector>
#include <mutex>
#include <sstream>
#include <unordered_map>
#include "../mqcommon/mq_msg.pb.h"
#include "../mqcommon/mq_loger.hpp"
#include "../mqcommon/mq_helper.hpp"
#include "../mqcommon/mq_proto.pb.h"


namespace mq{
                                                    //消费者标识，消息属性，消息内容
    using ConsumerCallback = std::function<void(const std::string&,const mq::BasicProperties* bp,const std::string&)>;
    //消费者管理结构
    struct Consumer{
        std::string tag;//消费者标识
        std::string qname;//消费者订阅的队列名称
        bool auto_ack;//自动确认标识
        ConsumerCallback callback;//回调函数

        Consumer(){
            DLOG("new Consumer：%p ",this);
        }
        Consumer(const std::string& ctag,const std::string& queue_name,bool ack_flag, const ConsumerCallback &cb)
                                    :tag(ctag),qname(queue_name),auto_ack(ack_flag),callback(std::move(cb)){
            DLOG("new Consumer：%p ",this);
        }

        ~Consumer(){
            DLOG("del Consumer：%p ",this);//查看地址防止资源泄露
        }

        using ptr = std::shared_ptr<Consumer>;
    };
}

#endif